<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column align="center" label="贷款编号" width="220">
        <template slot-scope="scope">
          {{ scope.row.applyNumber }}
        </template>
      </el-table-column>
      <el-table-column label="申请人姓名">
        <template slot-scope="scope">
          {{ scope.row.customerName }}
        </template>
      </el-table-column>
      <el-table-column label="贷款金额">
        <template slot-scope="scope">
          {{ scope.row.loanAmount }}
        </template>
      </el-table-column>
      <el-table-column label="贷款用途">
        <template slot-scope="scope">
          {{ scope.row.purpose }}
        </template>
      </el-table-column>
      <el-table-column label="收款银行卡号" width="160">
        <template slot-scope="scope">
          {{ scope.row.bankNumber }}
        </template>
      </el-table-column>
      <el-table-column label="还款期限">
        <template slot-scope="scope">
          {{ scope.row.loanTerm }}
        </template>
      </el-table-column>
      <el-table-column label="贷款利率">
        <template slot-scope="scope">
          {{ scope.row.loanRate }}%
        </template>
      </el-table-column>
      <el-table-column label="放款金额">
        <template slot-scope="scope">
          {{ scope.row.releaseAmount }}
        </template>
      </el-table-column>
      <el-table-column label="放款时间" width="160">
        <template slot-scope="scope">
          {{ scope.row.releaseTime }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getListByStatus } from '@/api/loanApi'

export default {
  data() {
    return {
      list: null,
      listLoading: true
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.listLoading = true
      getListByStatus({ status: 5 }).then(response => {
        this.list = response.data.records
        this.listLoading = false
      })
    }
  }
}
</script>
